/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package bpmn.impl;

import bpmn.BpmnPackage;
import bpmn.BusinessProcessDiagram;
import bpmn.Pool;

import java.util.Collection;
import java.util.Date;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Business Process Diagram</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getId <em>Id</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getName <em>Name</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getVersion <em>Version</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getAuthor <em>Author</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getLanguage <em>Language</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getQueryLanguage <em>Query Language</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getCreationDate <em>Creation Date</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getModificationDate <em>Modification Date</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getPools <em>Pools</em>}</li>
 *   <li>{@link bpmn.impl.BusinessProcessDiagramImpl#getDocumentation <em>Documentation</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BusinessProcessDiagramImpl extends EObjectImpl implements BusinessProcessDiagram {
	/**
	 * The default value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected static final Integer ID_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected Integer id = ID_EDEFAULT;

	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getVersion()
	 * @generated
	 * @ordered
	 */
	protected static final String VERSION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getVersion()
	 * @generated
	 * @ordered
	 */
	protected String version = VERSION_EDEFAULT;

	/**
	 * The default value of the '{@link #getAuthor() <em>Author</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAuthor()
	 * @generated
	 * @ordered
	 */
	protected static final String AUTHOR_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getAuthor() <em>Author</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAuthor()
	 * @generated
	 * @ordered
	 */
	protected String author = AUTHOR_EDEFAULT;

	/**
	 * The default value of the '{@link #getLanguage() <em>Language</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLanguage()
	 * @generated
	 * @ordered
	 */
	protected static final String LANGUAGE_EDEFAULT = "English";

	/**
	 * The cached value of the '{@link #getLanguage() <em>Language</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLanguage()
	 * @generated
	 * @ordered
	 */
	protected String language = LANGUAGE_EDEFAULT;

	/**
	 * The default value of the '{@link #getQueryLanguage() <em>Query Language</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getQueryLanguage()
	 * @generated
	 * @ordered
	 */
	protected static final String QUERY_LANGUAGE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getQueryLanguage() <em>Query Language</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getQueryLanguage()
	 * @generated
	 * @ordered
	 */
	protected String queryLanguage = QUERY_LANGUAGE_EDEFAULT;

	/**
	 * The default value of the '{@link #getCreationDate() <em>Creation Date</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCreationDate()
	 * @generated
	 * @ordered
	 */
	protected static final Date CREATION_DATE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getCreationDate() <em>Creation Date</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCreationDate()
	 * @generated
	 * @ordered
	 */
	protected Date creationDate = CREATION_DATE_EDEFAULT;

	/**
	 * The cached value of the '{@link #getModificationDate() <em>Modification Date</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getModificationDate()
	 * @generated
	 * @ordered
	 */
	protected EList<Date> modificationDate;

	/**
	 * The cached value of the '{@link #getPools() <em>Pools</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPools()
	 * @generated
	 * @ordered
	 */
	protected EList<Pool> pools;

	/**
	 * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDocumentation()
	 * @generated
	 * @ordered
	 */
	protected static final String DOCUMENTATION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDocumentation()
	 * @generated
	 * @ordered
	 */
	protected String documentation = DOCUMENTATION_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BusinessProcessDiagramImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return BpmnPackage.Literals.BUSINESS_PROCESS_DIAGRAM;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setId(Integer newId) {
		Integer oldId = id;
		id = newId;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__ID, oldId, id));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getVersion() {
		return version;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setVersion(String newVersion) {
		String oldVersion = version;
		version = newVersion;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__VERSION, oldVersion, version));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getAuthor() {
		return author;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAuthor(String newAuthor) {
		String oldAuthor = author;
		author = newAuthor;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__AUTHOR, oldAuthor, author));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLanguage() {
		return language;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLanguage(String newLanguage) {
		String oldLanguage = language;
		language = newLanguage;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__LANGUAGE, oldLanguage, language));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getQueryLanguage() {
		return queryLanguage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setQueryLanguage(String newQueryLanguage) {
		String oldQueryLanguage = queryLanguage;
		queryLanguage = newQueryLanguage;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__QUERY_LANGUAGE, oldQueryLanguage, queryLanguage));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Date getCreationDate() {
		return creationDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCreationDate(Date newCreationDate) {
		Date oldCreationDate = creationDate;
		creationDate = newCreationDate;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__CREATION_DATE, oldCreationDate, creationDate));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Date> getModificationDate() {
		if (modificationDate == null) {
			modificationDate = new EDataTypeUniqueEList<Date>(Date.class, this, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__MODIFICATION_DATE);
		}
		return modificationDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Pool> getPools() {
		if (pools == null) {
			pools = new EObjectContainmentEList<Pool>(Pool.class, this, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__POOLS);
		}
		return pools;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDocumentation() {
		return documentation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDocumentation(String newDocumentation) {
		String oldDocumentation = documentation;
		documentation = newDocumentation;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, BpmnPackage.BUSINESS_PROCESS_DIAGRAM__DOCUMENTATION, oldDocumentation, documentation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__POOLS:
				return ((InternalEList<?>)getPools()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__ID:
				return getId();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__NAME:
				return getName();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__VERSION:
				return getVersion();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__AUTHOR:
				return getAuthor();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__LANGUAGE:
				return getLanguage();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__QUERY_LANGUAGE:
				return getQueryLanguage();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__CREATION_DATE:
				return getCreationDate();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__MODIFICATION_DATE:
				return getModificationDate();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__POOLS:
				return getPools();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__DOCUMENTATION:
				return getDocumentation();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__ID:
				setId((Integer)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__NAME:
				setName((String)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__VERSION:
				setVersion((String)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__AUTHOR:
				setAuthor((String)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__LANGUAGE:
				setLanguage((String)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__QUERY_LANGUAGE:
				setQueryLanguage((String)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__CREATION_DATE:
				setCreationDate((Date)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__MODIFICATION_DATE:
				getModificationDate().clear();
				getModificationDate().addAll((Collection<? extends Date>)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__POOLS:
				getPools().clear();
				getPools().addAll((Collection<? extends Pool>)newValue);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__DOCUMENTATION:
				setDocumentation((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__ID:
				setId(ID_EDEFAULT);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__NAME:
				setName(NAME_EDEFAULT);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__VERSION:
				setVersion(VERSION_EDEFAULT);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__AUTHOR:
				setAuthor(AUTHOR_EDEFAULT);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__LANGUAGE:
				setLanguage(LANGUAGE_EDEFAULT);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__QUERY_LANGUAGE:
				setQueryLanguage(QUERY_LANGUAGE_EDEFAULT);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__CREATION_DATE:
				setCreationDate(CREATION_DATE_EDEFAULT);
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__MODIFICATION_DATE:
				getModificationDate().clear();
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__POOLS:
				getPools().clear();
				return;
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__DOCUMENTATION:
				setDocumentation(DOCUMENTATION_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__ID:
				return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__VERSION:
				return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__AUTHOR:
				return AUTHOR_EDEFAULT == null ? author != null : !AUTHOR_EDEFAULT.equals(author);
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__LANGUAGE:
				return LANGUAGE_EDEFAULT == null ? language != null : !LANGUAGE_EDEFAULT.equals(language);
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__QUERY_LANGUAGE:
				return QUERY_LANGUAGE_EDEFAULT == null ? queryLanguage != null : !QUERY_LANGUAGE_EDEFAULT.equals(queryLanguage);
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__CREATION_DATE:
				return CREATION_DATE_EDEFAULT == null ? creationDate != null : !CREATION_DATE_EDEFAULT.equals(creationDate);
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__MODIFICATION_DATE:
				return modificationDate != null && !modificationDate.isEmpty();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__POOLS:
				return pools != null && !pools.isEmpty();
			case BpmnPackage.BUSINESS_PROCESS_DIAGRAM__DOCUMENTATION:
				return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (Id: ");
		result.append(id);
		result.append(", Name: ");
		result.append(name);
		result.append(", Version: ");
		result.append(version);
		result.append(", Author: ");
		result.append(author);
		result.append(", Language: ");
		result.append(language);
		result.append(", QueryLanguage: ");
		result.append(queryLanguage);
		result.append(", CreationDate: ");
		result.append(creationDate);
		result.append(", ModificationDate: ");
		result.append(modificationDate);
		result.append(", Documentation: ");
		result.append(documentation);
		result.append(')');
		return result.toString();
	}

} //BusinessProcessDiagramImpl
